package com.dao;

import com.pojo.Menu;
import com.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper {

	List<Menu> findAll();

	Menu findById(Integer id);

	int insert(Menu menu);

	int update(Menu menu);

	int deleteById(Integer id);

	@Select("SELECT m.* FROM sys_menu m " +
			"INNER JOIN role_menu rm ON m.id = rm.menu_id " +
			"INNER JOIN sys_role r ON rm.role_id = r.id " +
			"WHERE r.flag = #{roleFlag}")
	List<Menu> findMenusByRoleFlag(String roleFlag);
}
